package com.eric.data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

public class SEMApriori extends Apriori{
	
	private static final String positive = "OK";
	
	private static final String negative = "NO";
	
	private static Map<List<String>, Integer> positiveResult = new HashMap<>();
	
	private static Map<List<String>, Integer> negativeResult = new HashMap<>();

	public SEMApriori(String input) {
		super(input);
	}
	
	public Map<List<String>, Integer> calculate () {
		for (Entry<List<String>,Integer> e : result.entrySet()) {
			if (e.getKey().contains(positive) 
					|| e.getKey().contains(positive.toLowerCase())
					&& e.getKey().size() > 2
					) {
				positiveResult.put(e.getKey(), e.getValue());
			}else if (e.getKey().contains(negative) 
					|| e.getKey().contains(negative.toLowerCase())
					&& e.getKey().size() > 2
					){
				negativeResult.put(e.getKey(), e.getValue());
			}
		}
		return positiveResult;
	}
	
	public Map<List<String>, Integer> getNegative () {
		return negativeResult;
	}

}
